<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>管理员登录</title>
    <script src="__INDEX__/js/mui.min.js"></script>
	<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="__INDEX__/css/iconfont.css" />
	<link rel="stylesheet" href="__INDEX__/css/style.css" />
	<link rel="stylesheet" href="__INDEX__/css/mall.css" />	
</head>

<body>
	<div class="mui-content zhuc_content">
		<div class="login_top"><img src="__INDEX__/images/yujia_logo.png"></div>
		<form id="login-form" class="login_formbox">
			<div class="mui-input-row">
				<label><span class="iconfont icon-dianhua"></span></label>
				<input type="text" id="login_name" name="login_name" class="mui-input-clear mui-input" placeholder="请输入账号" data-input-clear="1"><span class="mui-icon mui-icon-clear mui-hidden"></span>
			</div>
			<div class="mui-input-row">
				<label><span class="iconfont icon-mima"></span></label>
				<input type="password" id="login_pwd" name="login_pwd" class="mui-input-clear mui-input" placeholder="请输入密码" data-input-clear="3"><span class="mui-icon mui-icon-clear mui-hidden"></span>
			</div>
		</form>
		<a class="regist_btn" id="btn"><img src="__INDEX__/images/login_btn.png"></a>
		
	</div>
</body>

</html>
<script type="text/javascript" src="/public/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/public/static/js/jquery.form.js"></script>
<script type="text/javascript" src="/public/static/layui/layui.all.js"></script>
<script type="text/javascript" src="/public/static/js/assist.js"></script>
<script>
	//提交请求
	$('#btn').click(function() {
		var name = $("#login_name").val();
		var pwd = $("#login_pwd").val();
		
		if(name == '') {
			layer.msg('账号不能为空');
			return;
		}
		if(pwd.trim() == '') {
			layer.msg('密码不能为空');
			return;
		}
		btn.disabled = true;
		setTimeout(function() {
			btn.disabled = false;
		}, 1500);
		//写入数据库
		$.ajax({
			type:"post",
			url: "{:url('index/admin/login')}",
			data: $('#login-form').serialize(),//表单数据
			success: function(data) {
				layer.msg(data.msg, {
				  icon: 1,
				  time: 1500 //2秒关闭（如果不配置，默认是3秒）
				}, function(){
					if(data.code==200){
						location.href='index.html';
					}					
				}); 
			}
		})
	});
</script>